﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MSDNWebcast
{
    /// <summary>
    /// Interaction logic for MainWin.xaml
    /// </summary>
    public partial class Shell : Window
    {
        public Shell()
        {
            InitializeComponent();
        }


        /// <summary>
        /// 页签开始切换, 切换视频播放界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TabControl_SelectionChanging(object sender, RoutedEventArgs e)
        {
            var arg = e as SelectionChangedEventArgs;
            if (arg == null) return;

            if (arg.AddedItems.Contains(this.videoTab))
            {
                this.Dispatcher.BeginInvoke(new Action(() => ((Storyboard)this.Resources["BackgroundChange"]).Begin()));
            }
            else if (arg.RemovedItems.Contains(this.videoTab))
            {
                this.Dispatcher.BeginInvoke(new Action(() => ((Storyboard)this.Resources["BackgroundChange1"]).Begin()));
            }
        }
    }
}
